package Easy;

// 1108. IP 地址无效化
public class Solution1108 {
    public String defangIPaddr(String address) {
        int turn = 3;
        int last = 0;
        while (turn > 0) {
            int index = address.indexOf('.', last);
            address = address.substring(0, index - 1) + "[.]" + address.substring(index + 1);
            last = index + 3;
            turn--;
        }
        return address;
    }
}
